<template>
  <el-row class="menu-card" type="flex">
    <el-col
      :style="{ 'margin-left': marginLeft + 'px' }"
      v-for="item in info"
      :key="item.menuId"
    >
      <el-card :body-style="{ padding: '0px' }">
        <router-link :to="{ name: 'detail', params: { menuId: item.menuId } }">
          <img :src="item.product_pic_url" alt="" class="image" />
          <div class="menu-card-detail">
            <strong>{{ item.title }}</strong>
            <span>{{ item.comments_len }} 评论</span>
            <router-link
              :to="{ name: 'space', query: { userId: item.userId } }"
              tag="em"
            >
              {{ item.name }}
            </router-link>
          </div>
        </router-link>
      </el-card>
    </el-col>
  </el-row>
</template>

<script>
export default {
  props: {
    marginLeft: {
      type: Number,
      default: 22,
    },
    info: Array,
  },
};
</script>

<style>
.menu-card {
  flex-wrap: wrap; /* 允许多行 */
}
.menu-card .el-col-24 {
  width: auto;
  margin-bottom: 20px;
  margin-left: 22px;
}
.image {
  width: 232px;
  height: 232px;
}
.menu-card-detail {
  padding: 14px;
}
.menu-card-detail > * {
  display: block;
}
.menu-card-detail strong {
  height: 24px;
  line-height: 24px;
  font-size: 14px;
  font-weight: bold;
  color: #333;
}
.menu-card-detail span {
  height: 26px;
  line-height: 26px;
  font-size: 12px;
  color: #999;
}
.menu-card-detail em {
  height: 23px;
  line-height: 23px;
  font-size: 12px;
  color: #ff3232;
}
</style>